1. Field of the Invention
The present invention relates to a data buffering system and a method, and more particularly, to a data buffering system and a method for an optical recording device.
2. Description of the Prior Art
An optical recording medium, such as audio compact disc (CD) and video CD, is for recording data. To use the data recorded in the optical recording medium, an optical reading/recording device is used with a data buffering procedure. The procedure is to read the data of the optical recording medium and to record the data into a buffer memory of the optical reading/recording device. And then a host reads and uses the buffered data from the buffer memory.
Referring to FIG. 1, FIG. 1 shows a data reading procedure of a data file in a conventional optical recording medium 10. The optical recording medium 10 can be a video CD. The optical recording medium 10 comprises a plurality of frames 12. Each of the frames 12 comprises a 1-byte subcode 14 and two 12-bytes main data 16a, 16b. There is a 4-bytes parity 18a between the main data frames 16a, 16b, and a 4-bytes parity 18b behind the main data frames 16a, 16b. Conventionally, before the optical reading/recording device receives an instruction from the computer host to read the data files of the optical recording medium 10, a microprocessor of the optical reading/recording device will read the frames 12 of the optical recording medium 10 first, designated as (a) in FIG. 1.
Next, the microprocessor of the optical reading/recording device diagnoses every frame 12, designated as (b). The diagnose procedure is first to diagnose two main data 16a and 16b of each of the frames one by one by using the parities, and then to combine two main data 16a and 16b into a 24-bytes main data 16.
After processing 98 frames, the microprocessor combines 98 frames 12 that have been diagnosed to become a block 20, designated as (c) in FIG. 1. Each of the 98 subcodes is combined into a subcode frame 22, and each of the 98 main data is combined into a main data frame 24. Every data file of the optical recording medium comprises a plurality of blocks 20 sequentially arranged. Each of the blocks 20 comprises a subcode frame 22 and a main data frame 24. The optical reading/recording device sequentially reads the data files of the blocks 20 of the optical recording medium 10.
As shown in FIG. 1, each of the data files of the optical recording medium 10 comprises a plurality of blocks 20 sequentially arranged. The main data frames 24 record the data files. Each of the blocks 20 comprises a subcode frame 22 and a main data frame 24. The subcode frames 22 record the address information and the data file information of the blocks 20, such as serial number, time, . . . etc of the data.
Referring to FIG. 2 and FIG. 3, FIG. 2 is a schematic diagram of a data buffering system 30 in the conventional optical reading/recording device. FIG. 3 is a schematic diagram of a main data stream A and a subcode stream B with time sequence read by the reading module 32 shown in FIG. 2. After the optical reading/recording device reads each of the blocks 20, input each of the blocks 20 sequentially to the data buffering system 30 to be used by the computer host.
As shown in FIG. 2, the conventional data buffering system 30 comprises a reading module 32, a transferring module of the main data 34, a transferring module of the subcodes 36, a target comparator 38, a transferring module 40, a buffer memory 42, and a microprocessor 44. The reading module 32 is used to execute the data reading procedure mentioned above, and to read the main data frames 22 and the subcode frames 24 of the sequentially arranged blocks 20 as a main data stream A and a subcode stream B, respectively (shown in FIG. 3). Each of the main data frames 22 and the subcode frames 24 has a frame code for identification. The frame codes are usually represented as minute/second/frame(MSF).
The transferring module of the main data 34 is used to transfer the main data recorded in each of the main data frames of the main data stream to the transferring module 40 in the FIFO (first in first out) sequence. The transferring module of the subcodes 36 is used to transfer the subcodes recorded in each of the subcode frames of the subcode stream to the transferring module 40 in the FIFO sequence.
The target comparator 38 inputs a target MSF of the main data from the microprocessor 44. The target MSF of the main data is a corresponding MSF of the start main data, and used to be the initial point when the transferring module 40 begins to transfer and buffer. When the target comparator 38 detects that the corresponding main data frames of the target MSF of the main data input into the transferring module 40, trigger a transferring procedure to transfer and buffer the data of the main data frames and the subcode frames that input in the transferring module 40 in the meantime into a corresponding recording unit of the buffer memory 42.
However, the main data frames and the subcode frames in the same data block will not be inputted into the transferring module 40 in the meantime, because the time needed for the reading module 32 to read the subcode frames 22 and the main data frames 24 are different. According to the prior art, because the data amount of the main data is higher and the diagnosing procedure is needed for the main data, the latency of the main data stream is more than that of the subcode stream about 1˜3 blocks. As shown in FIG. 3, in the main data stream A and the subcode stream B, the numbers in each squares represent the MSF of the main data frames or the subcode frames. For example, 2/3/5 in the main data stream means the main data recorded in the main data frames of 2/3/5.
As shown in FIG. 3, when the main data frames and the subcode frames of the same data block have the same MSF, then in the same time sequence, the main data stream A delays three more data blocks in comparison with the subcode stream B. Therefore, if the microprocessor 44 sets the target data blocks from 2/3/5 to 2/3/9, the transferring module will transfer the main data that recorded in the main data frames from 2/3/5 to 2/3/9 of the main data stream A, and the subcode which are inputted into the transferring module 40 in the meantime (T1 and T2) which are the subcode frames from 2/3/8 to 2/3/12 of the subcode stream B. Therefore, the same recording unit in the buffer memory 42 will record the data from the main data frame of 2/3/5 and in the subcode frame of 2/3/8, but not data from the main data frame of 2/3/5 and the subcode frame of 2/3/5 in the same data block.
In order to solve the problem that the main data and the subcode of the same recording unit belong to different block, the U.S. Pat. No. 6,058,453 provides a method for synchronous transferring the main data and the subcode. According to the U.S. Pat. No. 6,058,453, a target module of the subcode is added into the conventional data buffering system, so that the transferring module can transfer and buffer the main data frames and the subcode frames with the same MSF to the same recording unit.
There is a disadvantage of this method. Because it is not to buffer the main data frames and the subcode frames of the same data block into the same recording unit, but to buffer the main data frames and the subcode frames with the same MSF into the same recording unit. If the MSF of the main data and the MSF of the subcodes of the same data block are the same, then this method can achieve the objective to record the main data frames and the subcodes frames of the same data block to the same recording unit. However, for some reason, the MSF of the main data frames and the MSF of the subcode frames sometimes are not the same, in such situation the method disclosed in the U.S. Pat. No. 6,058,453 can no longer record the main data frames and the subcode frames of the same data block into the same recording unit.